#include "power_board_pkg/timer_ros.h"
#include <sys/time.h>

Task_Last_Time_Type Tasklasttime;

/*用于线程的延时函数*/
int mySleep_ms(float ms)
{
    struct timeval t_timeval;
    t_timeval.tv_sec = 0;
    t_timeval.tv_usec = 1000 * ms;
    select(0,NULL,NULL,NULL,&t_timeval);
    return 0;
}


double Get_Curtime(void)
{
	return rclcpp::Clock().now().seconds();
}

bool is_Timeout(double* lasttime,uint32_t time)
{
	double curtime;
	curtime = Get_Curtime();

	if((curtime - *lasttime) * 1000 >= time)  
	{
		// printf("curtime = %lf *lasttime = %lf\n",curtime,*lasttime);
		*lasttime = curtime;  
		return true;  
	}
	else
		return false;  
}










